/*
 * UpdateHandler.java
 *
 * Created on December 5, 2006, 12:42 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package com.asaga.tools;
import java.io.*;
import java.net.*;

import javax.servlet.*;
import javax.servlet.http.*;

import java.sql.*;
import java.util.*;
/**
 *
 * @author jeremys
 */
public class UpdateHandler {
    private SystemClient_DBImpl sc;
    private String errmsg;
    /** Creates a new instance of UpdateHandler */
    public UpdateHandler(HttpServletRequest request, SystemClient_DBImpl s) {
        this.sc = s;
        //this.sc = new SystemClient_DBImpl();
        this.sc.setFname(request.getParameter("fname"));
        this.sc.setLname(request.getParameter("lname"));
        this.sc.setAddr1(request.getParameter("addr1"));
        this.sc.setAddr2(request.getParameter("addr2"));
        this.sc.setCity(request.getParameter("city"));
        this.sc.setState(request.getParameter("state"));
        this.sc.setZip(request.getParameter("zip")); 
        this.sc.setPhone(request.getParameter("phone"));
        this.sc.setCell(request.getParameter("cell"));
        this.sc.setDob(request.getParameter("dob"));
        this.sc.setFontColor(request.getParameter("fontColor"));
    }
    public boolean UpdateInfo(String username){
        if(this.sc.updateProfile(username)==false){
            this.errmsg = this.sc.getErrorMessage();
            return false;
        }
        else{
            this.errmsg = this.sc.getErrorMessage();
            return true;
        }
    }
    public SystemClient_DBImpl getProfile(){
        return this.sc;
    }
    public String getError(){
        return this.errmsg;
    }
      
}
